import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ClubCardVO, ClubCardForm, ClubCardQuery } from '@/api/primary/clubCard/types';

/**
 * 查询会员卡信息列表
 * @param query
 * @returns {*}
 */

export const listClubCard = (query?: ClubCardQuery): AxiosPromise<ClubCardVO[]> => {
  return request({
    url: '/primary/clubCard/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询会员卡信息详细
 * @param id
 */
export const getClubCard = (id: string | number): AxiosPromise<ClubCardVO> => {
  return request({
    url: '/primary/clubCard/' + id,
    method: 'get'
  });
};

/**
 * 新增会员卡信息
 * @param data
 */
export const addClubCard = (data: ClubCardForm) => {
  return request({
    url: '/primary/clubCard',
    method: 'post',
    data: data
  });
};

/**
 * 修改会员卡信息
 * @param data
 */
export const updateClubCard = (data: ClubCardForm) => {
  return request({
    url: '/primary/clubCard',
    method: 'put',
    data: data
  });
};

/**
 * 删除会员卡信息
 * @param id
 */
export const delClubCard = (id: string | number | Array<string | number>) => {
  return request({
    url: '/primary/clubCard/' + id,
    method: 'delete'
  });
};
